<?php

class webwiHTML 
	{
			
		public static function printHead()
		{
			loadLanguage('main');
			// * Workaround für Browser, die ansonsten Darstellungsprobleme
			// * mit UTF-8-codierten Seiten bekommen (bspw. Google Chrome)
			header('Content-Type: text/html; charset=UTF-8');
			// * Head ausgeben
			echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01Transitional//EN">'. NEWLINE;
			echo '<html>'. NEWLINE;
			echo '<head>'. NEWLINE;
			echo '<title>'.HTML_TITLE.'</title>'. NEWLINE;
			echo '<meta http-equiv="content-type" content="text/html;charset=UTF-8">'. NEWLINE;
			echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . NEWLINE;
			echo self::dispDynMataTags();
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/bootstrap-cerulean.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/bootstrap-responsive.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/netwebwi-app.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/chosen.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/colorbox.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/elfinder.min.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/elfinder.theme.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/fullcalendar.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/fullcalendar.print.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/jquery-ui-1.8.21.custom.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/jquery.cleditor.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/jquery.iphone.toggle.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/jquery.noty.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/noty_theme_default.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/opa-icons.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/uniform.default.css">'. NEWLINE;
			echo '<link rel="stylesheet" type="text/css" href="' . WEBWI_URL . '/css/uploadify.css">'. NEWLINE;
			echo '<style type="text/css">
					body 
					{
						padding-bottom: 40 px;
					}
					.sidebar-nav
					{
						padding: 9 px 0;
					}
				 </style>' . NEWLINE;
			echo '<!--[if lt IE 9]>'. NEWLINE;
	 	 	echo '<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>'. NEWLINE;
			echo '<![endif]-->' . NEWLINE;
			echo '<link rel="shortcut icon" href="' . WEBWI_URL . '/img/favicon.ico">'. NEWLINE;
			
	}
	
	public static function printBody($id = null, $withMessage = true)
	{
		echo '</head>'. NEWLINE;
		echo '<body';
			if($id!=null)
			{
				echo ' id="'.$id.'"';
			}
		echo '>'. NEWLINE;
		
		// * Message ausgabe einbinden
		if($withMessage == true){
			if (! empty($message)) {
				webwiShowMessage($message);
			unset($message);
			}
		}
		
		if(isset($_SESSION['u']['id']))
		{
			include WEBWI_ROOT_PATH . DS . 'system' . DS . 'topBar.php';						
		}
		echo '<div class="container-fluid">' . NEWLINE;
		echo '<div class="row-fluid">' . NEWLINE;
		if(isset($_SESSION['u']['id']))
		{
			include WEBWI_ROOT_PATH . DS . 'system' . DS . 'navigation.php';
		}
		echo '<div id="content" class="span10">' . NEWLINE;
		echo '<!-- content starts -->' . NEWLINE;
	}

	
	public static function printFooter()
	{
		echo "<!-- content ends -->" . NEWLINE;
		echo "</div><!--/#content.span10-->" . NEWLINE;
		echo "</div><!--/fluid-row-->" . NEWLINE;
		echo "</div><!--/.fluid-container-->" . NEWLINE;
		echo self::dispJSincludes();
		echo "</body></html>". NEWLINE;
	}

	
	public static function printArray($array = array())
	{
		return highlight_string(print_r($array,true),true);
	}

	public static function dispDynMataTags()
	{
		global $webwiConfig;
		
		$meta = '<meta name="author" content="' . $webwiConfig['wiMetaAuthor'] . '">' . NEWLINE;
		$meta .= '<meta name="keywords" content="' . $webwiConfig['wiMetaKeywords'] . '">' . NEWLINE;
		$meta .= '<meta name="description" content="' . $webwiConfig['wiMetaDescription'] . '">' . NEWLINE;
		
		return $meta;
	}
		
	private static function dispJSincludes()
	{
	$main_js = '<!-- moved in foot for faster page load times -->' . NEWLINE;	
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery-1.7.2.min.js"></script>' . NEWLINE;
	$main_js .= '<!-- jQuery UI -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery-ui-1.8.21.custom.min.js"></script>' . NEWLINE;
	$main_js .= '<!-- transition / effect library -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/bootstrap-transition.js"></script>' . NEWLINE;
	$main_js .= '<!-- alert enhancer library -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/bootstrap-alert.js"></script>' . NEWLINE;
	$main_js .= '<!-- modal / dialog library -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/bootstrap-modal.js"></script>' . NEWLINE;
	$main_js .= '<!-- custom dropdown library -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/bootstrap-dropdown.js"></script>' . NEWLINE;
	$main_js .= '<!-- scrolspy library -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/bootstrap-scrollspy.js"></script>' . NEWLINE;
	$main_js .= '<!-- library for creating tabs -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . ' /js/bootstrap-tab.js"></script>' . NEWLINE;
	$main_js .= '<!-- library for advanced tooltip -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/bootstrap-tooltip.js"></script>' . NEWLINE;
	$main_js .= '<!-- popover effect library -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/bootstrap-popover.js"></script>' . NEWLINE;
	$main_js .= '<!-- button enhancer library -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/bootstrap-button.js"></script>' . NEWLINE;
	$main_js .= '<!-- accordion library (optional) -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/bootstrap-collapse.js"></script>' . NEWLINE;
	$main_js .= '<!-- carousel slideshow library (optional) -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/bootstrap-carousel.js"></script>' . NEWLINE;
	$main_js .= '<!-- autocomplete library -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/bootstrap-typeahead.js"></script>' . NEWLINE;
	$main_js .= '<!-- tour library -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/bootstrap-tour.js"></script>' . NEWLINE;
	$main_js .= '<!-- library for cookie management -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.cookie.js"></script>' . NEWLINE;
	$main_js .= '<!-- calander plugin -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/fullcalendar.min.js"></script>' . NEWLINE;
	$main_js .= '<!-- data table plugin -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.dataTables.min.js"></script>' . NEWLINE;

	$main_js .= '<!-- chart libraries start -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/excanvas.js"></script>' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.flot.min.js"></script>' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.flot.pie.min.js"></script>' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.flot.stack.js"></script>' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.flot.resize.min.js"></script>' . NEWLINE;
	$main_js .= '<!-- chart libraries end -->' . NEWLINE;

	$main_js .= '<!-- select or dropdown enhancer -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.chosen.min.js"></script>' . NEWLINE;
	$main_js .= '<!-- checkbox, radio, and file input styler -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.uniform.min.js"></script>' . NEWLINE;
	$main_js .= '<!-- plugin for gallery image view -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.colorbox.min.js"></script>' . NEWLINE;
	$main_js .= '<!-- rich text editor library -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.cleditor.min.js"></script>' . NEWLINE;
	$main_js .= '<!-- notification plugin -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.noty.js"></script>' . NEWLINE;
	$main_js .= '<!-- file manager library -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.elfinder.min.js"></script>' . NEWLINE;
	$main_js .= '<!-- star rating plugin -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.raty.min.js"></script>' . NEWLINE;
	$main_js .= '<!-- for iOS style toggle switch -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.iphone.toggle.js"></script>' . NEWLINE;
	$main_js .= '<!-- autogrowing textarea plugin -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.autogrow-textarea.js"></script>' . NEWLINE;
	$main_js .= '<!-- multiple file upload plugin -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.uploadify-3.1.min.js"></script>' . NEWLINE;
	$main_js .= '<!-- history.js for cross-browser state change on ajax -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/jquery.history.js"></script>' . NEWLINE;
	$main_js .= '<!-- application script for NetWebWI -->' . NEWLINE;
	$main_js .= '<script src="'. WEBWI_URL . '/js/netwebwi.js"></script>' . NEWLINE;
	
	return $main_js;
	}
	
	public static function dispMessageDIV($message)
	{
		
	}
	
	public static function dispBoxedDIV($title, $sort = true, $span = null, $icon)
	{
		$div = '<div class="row-fluid';
			if(isset($sort) || !empty($sort) || $sort == true)
			{
				$div .= ' sortable';
			}
			$div .= '">'. NEWLINE;
			
		 		$div .= '<div class="box';
					if(isset($sort) || !empty($sort) || $sort == true)
					{
						$div .= ' span'. $span . '">' . NEWLINE;
					}
				  	$div .= '<div class="box-header well" data-original-title>' . NEWLINE;
						$div .= '<h2>'. self::getIconClass($icon).'&nbsp;'.$title.'</h2>' . NEWLINE;
						$div .= '<div class="box-icon">' .  NEWLINE;
							$div .= '<a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>';
							$div .= '<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>';
							$div .= '<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>' . NEWLINE;
						$div .= '</div>' . NEWLINE;
					$div .= '</div>' . NEWLINE;
					
					return $div;
	}
	
	private function getIconClass($icon)
	{
		$icon = '<i class="icon-' . $icon . '></i>';
		return $icon;
	}
		
	public static function boxOpen($content)
	{
		echo '<div class="box-content">	' . NEWLINE;
	}
	
	public static function boxClose()
	{
		echo '</div><!--DIV BoxContent -->' . NEWLINE;
		echo '</div><!--/span-->' . NEWLINE;
		echo '</div><!--/row-->' . NEWLINE;
	}
		
		
	public static function pagination()
	{
		// * TODO: PAGINATION LADEN
	}
		
		
		
		
		
		
		
		
		
			
} // class end
?>